use anyhow::Result;
use std::fs;
// use prost_build::Config;

fn main() -> Result<()> {
    fs::create_dir_all("src/pb")?;
    // let mut  config = Config::new();
    // config.out_dir("src/pb").type_attribute(".*", "#[derive(Serialize, Deserialize, Clone, Debug, Default)]");
    // config.compile_protos(&["../protos/messages.proto"],&["../protos"])?;
    // Ok(())
    tonic_prost_build::configure()
        .out_dir("src/pb")
        // .message_attribute(".","#[derive(Serialize)] #[serde(rename_all = \"snake_case\")]")
        // .type_attribute("MaterializeRequest", r#"#[derive(Eq, Hash)]"#)
        .compile_protos(
            &[
                "../protos/metadata/messages.proto",
                "../protos/metadata/rpc.proto",
            ],
            &["../protos"],
        )?;
    Ok(())
}
